﻿CREATE PROCEDURE [dbo].[proc_ClientesInsert]
(
	@IdCliente bigint = NULL output,
	@Nome nvarchar(255)
)
AS
BEGIN

	SET NOCOUNT OFF
	DECLARE @Err int

	INSERT
	INTO [Clientes]
	(
		[Nome],
		[DataCriacao],
		[DataAlteracao]
	)
	VALUES
	(
		@Nome,
		GetDate(),
		GetDate()
	)

	SET @Err = @@Error

	SELECT @IdCliente = SCOPE_IDENTITY()
	
	Select @IdCliente

	RETURN @Err
END
